<!DOCTYPE html>
<html lang="">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>切换按钮</title>
    <link rel="stylesheet" href="style.css">
</head>

<body>
    <div class="card">
        <div class="toggle">
            <span></span>
            <span></span>
            <span></span>
        </div>
    </div>
</body>

<script>
    let toggle = document.querySelector('.toggle');
    toggle.onclick = () => {
        toggle.classList.toggle('active');
    }

</script>

</html>
